import javax.swing.*;
import java.awt.*;

//给panel加背景图片
public class ImagePanel extends JPanel {
    Image im;

    /**
     * 创建一个图形面板.
     *
     * @param im 图形
     */
    public ImagePanel(Image im) {
        this.im = im;
        int width = Settings.frame_w;
        int height = Settings.frame_h;
        this.setSize(width, height);
    }

    public void paintComponent(Graphics g1) {
        super.paintComponent(g1);  //清屏
        g1.drawImage(im, 0, 0, this.getWidth(), this.getHeight(), this);
    }

}
